home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / makemenu.zip / MAKEMENU.BAT < prev    next >
DOS Batch File  |  1989-05-09  |  5KB  |  189 lines

  1. echo off
  2. if '%1' == '??' put ?? 
  3. if '%1' == '??' goto die
  4. if '%1' == '' goto help
  5. if '%1' == '?' goto help
  6. if '%1' == 'makemenu' goto help
  7. if '%1' == 'MAKEMENU' goto help
  8. if not '%2' == '' goto help
  9. : test validity of menu-name
  10. echo erase me>%1.$mm
  11. if not exist %1.$mm goto help
  12. del %1.$mm
  13. :--------------------------------------------------------------------------
  14. cls
  15. echo                      M A K E   A   M E N U   : %1
  16. if not exist %1.bat goto getbrief
  17. echo  
  18. echo Replace existing %1.bat?   (Press Y for yes, N to exit)
  19. pick y n Esc
  20. if errorlevel 2 echo no
  21. if errorlevel 2 goto exit
  22. if not errorlevel 1 goto exit
  23. echo yes
  24. del %1.bat
  25. cls
  26. echo                      M A K E   A   M E N U   : %1
  27. :
  28. :getbrief
  29. :
  30. echo  
  31. echo Enter descriptive name for menu (for example "Main Menu"):
  32. get @se.*@!\26\60\62\124\192 1 45 >menudesc.$mm
  33. if errorlevel 5 goto badwrit
  34. if errorlevel 4 goto exit
  35. echo echo off >menu.$mm
  36. echo :start >>menu.$mm
  37. echo cls >>menu.$mm
  38. :
  39. :asktext
  40. :
  41. echo  
  42. if not exist %1.mnu goto gettext
  43. cls
  44. echo                      M A K E   A   M E N U   : %1
  45. echo  
  46. type %1.mnu
  47. echo  
  48. echo  
  49. echo  
  50. echo Is the text you want shown above? (Press Y for yes, N to enter new text)
  51. pick y n Esc
  52. if errorlevel 3 goto exit
  53. if errorlevel 2 echo no
  54. if errorlevel 2 goto gettext
  55. if not errorlevel 1 goto exit
  56. echo yes
  57. goto gottext
  58. :
  59. :gettext
  60. :
  61. cls
  62. echo                      M A K E   A   M E N U   : %1
  63. echo  
  64. echo Enter text for menu.  Press F6 when done:
  65. get @se.r@!\26\60\62\124\192 >%1.mnu
  66. if errorlevel 5 goto badwrit
  67. if errorlevel 4 goto exit
  68. goto asktext
  69. :
  70. :gottext
  71. :
  72. : make a box around the menu text
  73. :
  74. makebox c <%1.mnu >menutext.box
  75. makebox c* :echo <%1.mnu >>menu.$mm
  76. if errorlevel 1 goto badwrit
  77. :
  78. : initialize files
  79. :
  80. type nul >options.$mm
  81. type nul >cmdline.$mm
  82. type nul >goto.$mm
  83. type nul >exit.$mm
  84. echo 0 >count.$mm
  85. echox 1. pick >pick.$mm
  86. if errorlevel 1 goto badwrit
  87. :
  88. :getopt
  89. :
  90. cls
  91. type menutext.box
  92. echo  
  93. echo Options specified: 
  94. type options.$mm
  95. echo  
  96. echo  
  97. echo Press key for option to specify, or else type Ctrl-C if done.
  98. get @re.n!co@\27\13\10!.\ 1 1 >key$.$mm
  99. if errorlevel 5 goto badwrit
  100. if errorlevel 4 goto assemble
  101. define <key$.$mm \13=RET \10=RET \32=SP ╗=F1 ╝=F2 ╜=F3 ╛=F4 ┐=F5 └=F6 ┴=F7 ┬=F8 ├=F9 ─=F10 =Esc >option.$mm
  102. type option.$mm
  103. x echo :{option.$mm}-PICK >>cmdline.$mm
  104. echo cls >>cmdline.$mm
  105. : put a blank between options
  106. echo a b | xtrchars 2 1 >>options.$mm
  107. type option.$mm >>options.$mm
  108. echo 1 >count$.$mm
  109. type count.$mm >>count$.$mm
  110. sum <count$.$mm >count.$mm
  111. x echo if errorlevel {count.$mm} goto {option.$mm}-PICK >>goto.$mm
  112. echo  
  113. echo  
  114. echo Enter command line(s) to execute for the option.  Press F6 when done.
  115. get @sre@!\192  >>cmdline.$mm
  116. if errorlevel 5 goto badwrit
  117. if errorlevel 4 goto exit
  118. echo echo   >>cmdline.$mm
  119. x echo echo Strike any key to return to {menudesc.$mm} . . . >>cmdline.$mm
  120. echo pause \62nul >cmdline$.$mm
  121. decode <cmdline$.$mm >>cmdline.$mm
  122. echo goto start >>cmdline.$mm
  123. echo  
  124. echo  
  125. echo Do you want to specify more options?  (Press y for yes, n for no)
  126. pick n y Esc
  127. if errorlevel 3 goto exit
  128. if errorlevel 2 echo yes
  129. if errorlevel 2 goto getopt
  130. if errorlevel 1 echo no
  131. if errorlevel 1 goto assemble
  132. goto exit
  133. :
  134. :assemble
  135. :
  136. type goto.$mm >goto$.$mm
  137. backward 1 <goto$.$mm >goto.$mm
  138. if errorlevel 1 goto badwrit
  139. echo goto exit >>goto.$mm
  140. echo :exit >exit.$mm
  141. echo put 23 1 >>exit.$mm
  142. type options.$mm >options$.$mm
  143. ensure <options$.$mm >options.$mm
  144. if errorlevel 2 goto badwrit
  145. copy menu.$mm + pick.$mm + options.$mm + goto.$mm + cmdline.$mm + exit.$mm menu.$mm >nul
  146. move menu.$mm %1.bat >nul
  147. del *.$mm
  148. del menutext.box
  149. %1
  150. : we will not return to this batch file; but just in case...
  151. goto exit
  152. :--------------------------------------------------------------------------
  153. :
  154. :help
  155. :
  156. put -2 2x79
  157. echo EasyTools Utilities version 1.0 Copyright by EasyTools 1989 All Rights Reserved
  158. echo MAKEMENU requires:  PUT, GET, PICK, MAKEBOX, ECHOX, DEFINE, SUM, DECODE,
  159. echo                     BACKWARD, ENSURE, MOVE, X, XTRCHARS.
  160. echo  
  161. echo Usage:  MAKEMENU menu-name
  162. echo  
  163. echo For example, MAKEMENU MAIN
  164. echo  
  165. echo Creates batch file(s) that function as (multi-level) menu system.
  166. echo  
  167. echo Menu text (menu-name.MNU) can be created or modified by text-editor for
  168. echo easier manipulation if desired.
  169. echo  
  170. echo Note that registered users may distribute their menu systems, including
  171. echo any required EasyTool programs, without royalty.
  172. echo  
  173. echo For complete instructions, see User Guide (type "MAKEMENU ??")
  174. goto die
  175. :
  176. :badwrit
  177. :
  178. echo MAKEMENU:  Cannot write to disk.  Insufficient disk space?
  179. :
  180. :exit
  181. :
  182. echo a >x.$mm
  183. del *.$mm
  184. if exist menutext.box del menutext.box
  185. :
  186. :die
  187. :
  188. echo  
  189.